package com.cw.demo.bootstrap;

import org.apache.dubbo.config.annotation.DubboReference;

import com.cw.demo.api.DemoApi;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * 启动类
 */
@SpringBootApplication(scanBasePackages = {"com.cw"})
public class ApplicationBootstrap {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @DubboReference(version = "${dubbo.service.version}", group = "hrkj-demo-center",
            protocol = "${dubbo.protocol.name}", check = false)
    private DemoApi demoApi;

    public static void main(String[] args) {
        SpringApplication.run(ApplicationBootstrap.class);
    }

    @Bean
    public ApplicationRunner runner() {
        return args -> logger.info(demoApi.sayHello("mercyblitz"));
    }
}
